<template>
	<view class="beijingse1">
		<!-- 头部 -->
		<view class="" style="background-color:#141618;padding: 30rpx 30rpx 137rpx;" @click="jumper('/pages/login')"
			v-if="!is_login">
			<view class="flexbetween">
				<view class="flexleft">
					<image class="margin_right3" style="width: 120rpx;height: 120rpx;border-radius: 50%;"
						src="../static/logo.jpg" mode="">
					</image>
					<view class="xiaobai fonweight bigtext">未登录，点击登录</view>
				</view>
				<u-icon name="arrow-right" color="#FFFFFF" size="28"></u-icon>
			</view>
		</view>
		<view class="" style="background-color:#141618;padding: 30rpx 30rpx 137rpx;"
			@click="jumper('/pages_mypage/gerenxx')" v-if="is_login">
			<view class="flexbetween">
				<view class="flexleft">
					<image class="margin_right3" style="width: 120rpx;height: 120rpx;border-radius: 50%;"
						:src="userInfo.avatar_text" mode="">
					</image>
					<view class="">
						<view class="xiaobai fonweight bigtext">{{userInfo.nickname}}</view>
						<view class="xiaobai ershiba margin_top">{{userInfo.mobile}}</view>
					</view>
				</view>
				<u-icon name="arrow-right" color="#FFFFFF" size="28"></u-icon>
			</view>
		</view>
		<view class="mainpadding" style="position: relative;top: -104rpx;">
			<view class="ffffff mainpadding">
				<view class="flexbetween" @click="jumper('/pages_mypage/wodedingd')">
					<view class="sanshier fonweight xiaohei">我的订单</view>
					<view class="flexright">
						<view class="ershil xiaohei margin_right1">全部订单</view>
						<u-icon name="arrow-right" color="#999999"></u-icon>
					</view>
				</view>
				<view class="flexbetween margin_top">
					<view class="" @click="order(1)">
						<view class="flexcenter">
							<view class="dqicon dingwei">
								<image class="dqicon" src="../static/image/system/dfk.png" mode=""></image>
								<view class="huibiao">
									<u-badge  max="99" :value="dfh_num"></u-badge>
								</view>
							</view>
						</view>
						<view class="smalltext textcenter xiaohei margin_top1">待付款</view>
					</view>
					<view class="" @click="order(2)">
						<view class="flexcenter">
							<view class="dqicon dingwei">
								<image class="dqicon" src="../static/image/system/dfh.png" mode=""></image>
								<view class="huibiao">
									<u-badge  max="99" :value="dsh_num"></u-badge>
								</view>
							</view>
						</view>
						<view class="smalltext textcenter xiaohei margin_top1">待审核</view>
					</view>
					<view class="" @click="order(3)">
						<view class="flexcenter">
							<view class="dqicon dingwei">
								<image class="dqicon" src="../static/image/system/yfh.png" mode=""></image>
								<view class="huibiao">
									<u-badge  max="99" :value="dfh_num"></u-badge>
								</view>
							</view>
						</view>
						<view class="smalltext textcenter xiaohei margin_top1">待发货</view>
					</view>
					<view class="" @click="order(4)">
						<view class="flexcenter">
							<view class="dqicon dingwei">
								<image class="dqicon" src="../static/image/system/yfh.png" mode=""></image>
								<view class="huibiao">
									<u-badge  max="99" :value="dshouh_num"></u-badge>
								</view>
							</view>
						</view>
						<view class="smalltext textcenter xiaohei margin_top1">待收货</view>
					</view>
					<view class="" @click="order(5)">
						<view class="flexcenter">
							<view class="dqicon dingwei">
								<image class="dqicon" src="../static/image/system/ywc.png" mode=""></image>
								<view class="huibiao">
									<u-badge  max="99" :value="ywc_num"></u-badge>
								</view>
							</view>
						</view>
						<view class="smalltext textcenter xiaohei margin_top1">已完成</view>
					</view>
				</view>
			</view>
			
			<view class="mainpadding ffffff margin_top">
				<view class="xiahuaxian flexbetween" @click="jumper('/pages_mypage/shouhuodiz')">
					<view class="ershiba xiaohei">收货地址</view>
					<u-icon name="arrow-right" color="#999999"></u-icon>
				</view>
				<!-- xb_bzj_status：1=保证金不足，2=保证金已交，3=未交保证金 -->
				<view class="xiahuaxian flexbetween margin_top" @click="jumper('/pages_mypage/baozhengj')">
					<view class="ershiba xiaohei">保证金</view>
					<view class="flexright">
						<!-- <view class="ershiba xiaohong margin_right2" v-if="userInfo.xb_bzj_status==1">保证金不足</view>
						<view class="ershiba xiaohui margin_right2" v-if=" userInfo.xb_bzj_status==2">已缴纳</view>
						<view class="ershiba xiaohong margin_right2" v-if=" userInfo.xb_bzj_status==3">未缴纳</view> -->
						<u-icon name="arrow-right" color="#999999"></u-icon>
					</view>
				</view>
				<view class="xiahuaxian flexbetween margin_top" @click="jumper('/pages_mypage/bangzhuzx')">
					<view class="ershiba xiaohei">帮助中心</view>
					<u-icon name="arrow-right" color="#999999"></u-icon>
				</view>
				<button open-type="contact" hover-class="none">
					<view class="xiahuaxian margin_top flexbetween">
						<view class="ershiba xiaohei">联系我们</view>
						<u-icon name="arrow-right" color="#999999"></u-icon>
					</view>
				</button>
				<view class="margin_top flexbetween" @click="jumper('/pages_mypage/shezhi')">
					<view class="ershiba xiaohei">设置</view>
					<u-icon name="arrow-right" color="#999999"></u-icon>
				</view>
				<!-- <view class="margin_top flexbetween" @click="jumper('/pages_paimai/jiancebg')">
					<view class="ershiba xiaohei">检测报告</view>
					<u-icon name="arrow-right" color="#999999"></u-icon>
				</view> -->
			</view>
		</view>
		
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				is_login: false,
				userInfo: {},
				dfh_num:0,
				dsh_num:0,
				dshouh_num:0,
				dzf_num:0,
				ywc_num:0,
			}
		},
		onShareAppMessage: function(options) {
			return {
				title: '速鉴奢拍 为二奢同行交易赋能',
				imageUrl: '',
				path: '/pages/homepage?code=' + uni.getStorageSync("invite_code")
			}
		},
		onShow() {
			this.is_login = httpRequest.checkIsLogin();
			if (this.is_login) {
				this.init()
				this.getorderInfo()
			} else {
				this.userInfo = null
				this.dfh_num=0
				this.dsh_num=0
				this.dshouh_num=0
				this.dzf_num=0
				this.ywc_num=0
			}
		},
		methods: {
			getorderInfo(){
				httpRequest.request('/api/ordercl/orderData', 'GET', {}).then(res => {
					this.dfh_num = res.data.dfh_num
					this.dsh_num = res.data.dsh_num
					this.dshouh_num = res.data.dshouh_num
					this.dzf_num = res.data.dzf_num
					this.ywc_num = res.data.ywc_num
				})
			},
			renzheng(){
				if (!httpRequest.checkIsLogin()) {
					uni.navigateTo({
						url: "/pages/login"
					})
					return false
				}
				if(this.userInfo.smrz==null || this.userInfo.smrz.status==0){
					this.jumper('/pages_mypage/renzhengxx')
					return false
				}
				this.jumper('/pages_mypage/shenhejg')
			},
			init() {
				httpRequest.request('/api/user/index', 'GET', {}).then(res => {
					if (res.code == 1) {
						this.userInfo = res.data
					} else {
						this.userInfo = null
					}
				})
			},
			// 跳转我的订单
			order(i) {
				uni.navigateTo({
					url: '/pages_mypage/wodedingd?i=' + i
				})
			},
			jumper(url) {
				if (!httpRequest.checkIsLogin()) {
					uni.navigateTo({
						url: "/pages/login"
					})
					return false
				}
				uni.navigateTo({
					url: url
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.huibiao{
		position: absolute;top: -3rpx;
		right: -3rpx;
	}
	.beijingse1 {
		background: #F5F5F5;
		min-height: calc(100vh - 0rpx);
		height: auto;
	}

	.dqicon {
		width: 60rpx;
		height: 60rpx;

	}
</style>